<!-- 侧边栏 -->
<template>
  <div class="app-side">
    <el-menu
      :unique-opened="true"
      :default-active="navActive"
      class="menu"
      :collapse="collapse"
      @open="handleOpen"
      background-color="#4c637b"
      text-color="#fff"
      active-text-color="#19a9d5"
      @close="handleClose">
      <!-- <label v-for="(item, index) in menuLists" :key="item.id">
        <el-submenu
          v-if="item.children.length !== 0"
          :index="index + ''">
          <template slot="title">
            <i :class="item.icon"></i>
            <span>{{item.label}}</span>
          </template>
          <el-menu-item v-for="mydt in item.children" :key="mydt.id" @click="$router.push({path: mydt.path})" :index="mydt.path">{{mydt.label}}</el-menu-item>
        </el-submenu>
        <el-menu-item v-if="item.children.length === 0" @click="$router.push({path: item.path})" :index="item.path">
          <i :class="item.icon"></i>
          <span slot="title">{{item.label}}</span>
        </el-menu-item>
      </label> -->
      <el-submenu
        v-for="(item, index) in menuLists"
        :key="item.id"
        :index="String(index + 1)">
        <template slot="title">
          <i :class="item.icon"></i>
          <span>{{item.label}}</span>
        </template>
        <el-menu-item v-for="mydt in item.children" :key="mydt.id" @click="$router.push({path: mydt.path})" :index="mydt.path">{{mydt.label}}</el-menu-item>
      </el-submenu>
      <!-- <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-tickets"></i>
          <span>出口放箱</span>
        </template>
        <el-menu-item @click="$router.push({path: '/webLayout/dropBoxMan'})" index="1-1">出口放箱管理</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/dropBoxHistory'})" index="1-2">出口放箱记录</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/alreadyPut'})" index="1-3">已放好客户</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/eirMan'})" index="1-4">电子EIR管理</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/canOrderMan'})" index="1-5">可打单管理</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/couldOrderMan'})" index="1-6">已打单管理</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/orderStatistics'})" index="1-7">打单统计</el-menu-item>
      </el-submenu>
      <el-menu-item index="2" @click="$router.push({path: '/webLayout/announcementMan'})">
        <i class="el-icon-bell"></i>
        <span  slot="title">公告管理</span>
      </el-menu-item>
      <el-menu-item index="3" @click="$router.push({path: '/webLayout/companySetting'})">
        <i class="el-icon-setting"></i>
        <span slot="title">公司设置</span>
      </el-menu-item>
      <el-submenu index="4">
        <template slot="title">
          <i class="el-icon-edit-outline"></i>
          <span>基础信息</span>
        </template>
        <el-menu-item @click="$router.push({path: '/webLayout/basicCost'})" index="4-1">基础费用</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/shipCompany'})" index="4-3">船代公司</el-menu-item>
      </el-submenu>
      <el-submenu index="5">
        <template slot="title">
          <i class="el-icon-edit"></i>
          <span>财务统计</span>
        </template>
        <el-menu-item @click="$router.push({path: '/webLayout/dailyCollection'})" index="5-1">日汇总表</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/monthTable'})" index="5-2">月统计表</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/dailyTable'})" index="5-3">日统计表</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/businessCollection'})" index="5-4">业务汇总表</el-menu-item>
      </el-submenu>
      <el-submenu index="6">
        <template slot="title">
          <i class="el-icon-goods"></i>
          <span>公司信息管理</span>
        </template>
        <el-menu-item @click="$router.push({path: '/webLayout/customeMan'})" index="6-1">客户管理</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/cpDataMaintain'})" index="6-2">公司资料维护</el-menu-item>
      </el-submenu>
      <el-submenu index="7">
        <template slot="title">
          <i class="el-icon-service"></i>
          <span>用户管理</span>
        </template>
        <el-menu-item @click="$router.push({path: '/webLayout/salesmanMan'})" index="7-1">业务员管理</el-menu-item>
        <el-menu-item @click="$router.push({path: '/webLayout/departmentMan'})" index="7-2">部门管理</el-menu-item>
      </el-submenu>
      <el-submenu index="8">
        <template slot="title">
          <i class="el-icon-search"></i>
          <span>预配查询</span>
        </template>
        <el-menu-item @click="$router.push({path: '/webLayout/previsionSearch'})" index="8-1">新海</el-menu-item>
      </el-submenu> -->
    </el-menu>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data () {
    return {
      navActive: ''
    }
  },
  computed: {
    ...mapState({
      collapse: state => state.web.collapse,
      menuLists: state => state.user.menuLists
    })
  },
  methods: {
    handleOpen (key, keyPath) {
    },
    handleClose (key, keyPath) {
    }
  },
  watch: {
    $route () {
      this.navActive = this.$route.path
      // console.log(this.navActive);
    }
  }
}
</script>

<style lang="less">
.app-side {
  width: 160px;
  overflow: hidden;
  background-color: #4c637b;
  position: relative;
}

</style>
